import request from '@/utils/request'
// 得到图片列表
export const getImageList = (spuId) => {
  return request({
    url: `/admin/product/spuImageList/${spuId}`,
    method: 'get'
  })
}
// 得到sku属性
export const getBaseSaleAttrList = (spuId) => {
  return request({
    url: `/admin/product/spuSaleAttrList/${spuId}`,
    method: 'get'
  })
}
// 得到sku属性信息
export const getSkuAttrList = ({ category1Id, category2Id, category3Id }) => {
  return request({
    url: `/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`,
    method: 'get'
  })
}
// 添加sku
export const addSku = (skuInfo) => {
  return request({
    url: '/admin/product/saveSkuInfo',
    method: 'post',
    data: skuInfo
  })
}
// 得到sku列表
export const getSkuList = (page, limit) => {
  return request({
    url: `/admin/product/list/${page}/${limit}`,
    method: 'get'
  })
}
// 上架sku
export const putawaySku = (skuId) => {
  return request({
    url: `/admin/product/onSale/${skuId}`,
    method: 'get'
  })
}
// 下架sku
export const pulldownSku = (skuId) => {
  return request({
    url: `/admin/product/cancelSale/${skuId}`,
    method: 'get'
  })
}
// 获取sku信息
export const getSkuInfoById = (skuId) => {
  return request({
    url: `/admin/product/getSkuById/${skuId}`,
    method: 'get'
  })
}
